package com.atguigu.gmall.common.retryer;

import feign.RetryableException;
import feign.Retryer;
import lombok.extern.slf4j.Slf4j;

@Slf4j
public class FeignClientRetryer implements Retryer {

    private int start = 1 ;

    private int end  = 3 ;

    @Override
    public void continueOrPropagate(RetryableException e) {
        log.info("FeignClientRetryer...continueOrPropagate方法执行了...");
        if(start > end) {
            throw e ;
        }
        start++ ;
    }

    @Override
    public Retryer clone() {
        return new FeignClientRetryer();        // 直接返回FeignClientRetryer对象
    }

}
